﻿//-----------------------------------------------------------------------
// <copyright file="SelectColumnsStep.cs" company="QUT">
//     Copyright QUT 2009.
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GenerateKml.Steps
{
    /// <summary>
    /// Select Columns Step.
    /// </summary>
    public partial class SelectColumnsStep : UserControl
    {
        /// <summary>
        /// The selected MapInfo columns.
        /// </summary>
        private List<string> _selectedColumns;

        /// <summary>
        /// Initializes a new instance of the <see cref="SelectColumnsStep"/> class.
        /// </summary>
        public SelectColumnsStep()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Gets the selected columns.
        /// </summary>
        /// <value>The selected columns.</value>
        public List<string> SelectedColumns
        {
            get
            {
                this._selectedColumns = new List<string>();
                foreach (string item in this.MapInfoColumnsCheckBoxList.CheckedItems)
                {
                    this._selectedColumns.Add(item);
                }

                return this._selectedColumns;
            }
        }

        /// <summary>
        /// Sets the available MapInfo columns.
        /// </summary>
        /// <param name="columns">The available columns.</param>
        public void SetColumns(List<string> columns)
        {
            this.MapInfoColumnsCheckBoxList.Items.Clear();
            this.MapInfoColumnsCheckBoxList.Items.AddRange(columns.ToArray());
        }
    }
}
